<template>
	<view class="container">
		<view class="card">
			<textarea v-model="notes" placeholder="学习心得..."></textarea>
		</view>
		<view @click="submit" class="btn">提交</view>
	</view>
</template>

<script>
export default{
	data(){
		return {
			notes: '',
			miss_id: ''
		}
	},
	onLoad(option){
		this.miss_id = option.id;
	},
	methods: {
		// 提交心得
		submit(id){
			uni.showLoading({title: '加载中'});
			uni.request({
				url: this.$API.eduVideoMyTaskLogAdd,
				data: {
					userid: uni.getStorageSync('userid'),
					miss_id: this.miss_id,
					notes: this.notes
				},
				method: 'POST',
				header: this.$API.get_head(),
				success: (res)=>{
					uni.hideLoading();
					uni.showToast({
						icon: 'none',
						title: '添加成功'
					});
					setTimeout(()=>{
						uni.navigateBack();
					}, 1000);
				},
				fail: ()=>{
					uni.hideLoading();
					uni.showToast({
						icon: 'none',
						title: '添加失败'
					})
				}
			})
		}
	}
}
</script>

<style scoped>
.container{
	padding-top: 20upx;
}

/*卡片*/
.card{
	background: #BFE9FF;
	margin: 0 20upx 20upx;
	border-radius: 16upx;
	padding: 20upx;
	border: 2upx solid #F6F6F6;
	box-shadow: 0 0 4upx #eee;
}
.card textarea{
	width: 100%;
	height: 400upx;
	font-size: 28upx;
	background: #F2F2F2;
	padding: 14upx 20upx;
	border-radius: 10upx;
	box-sizing: border-box;
}

.btn{
	color: #fff;
	width: 200upx;
	height: 52upx;
	font-size: 26upx;
	line-height: 52upx;
	border-radius: 6upx;
	text-align: center;
	margin: 40upx auto;
	background-color: red;
}
</style>
